<?php 
/** create by fu */
namespace app\api\model;

use app\api\model\BaseModel; 
/**
 * 
 */
class Category extends BaseModel
{
	//隐藏字段
	protected $hidden = ['topic_img_id','delete_time','update_time'];
	//关联模型
	public function product()
	{
		// 一对多 hasMany(从表，从表字段，本表字段)
		return $this->hasMany('product','category_id','id');
	}

	public function img()
	{
		return $this->belongsTo('Image','topic_img_id','id');
	}
}




 ?>